import { createApp } from "vue";
import "./style.css";
//黑暗模式样式
import "element-plus/theme-chalk/dark/css-vars.css";
import "./styles/element/index.scss";
import { ElMessage, ElMessageBox } from "element-plus";
//分页
import Pagination from "@/components/Pagination";


import "./assets/style/modelcss.scss";
import router from "@/router/index.js";
//权限
import directive from "./directive";
//前置路由
import "./permission";
//图标
import "virtual:svg-icons-register";
import SvgIcon from "@/components/SvgIcon";
import elementIcons from "@/components/SvgIcon/svgicon";
//字典
import { useDict } from "@/utils/dict";
import {
  parseTime,
  resetForm,
  addDateRange,
  handleTree,
  selectDictLabel,
  selectDictLabels,
} from "@/utils/ruoyi";
import { createPinia } from "pinia";

import * as ElementPlusIconsVue from "@element-plus/icons-vue";

import ElementPlus from "element-plus";

import App from "./App.vue";

// 创建 Vue 应用实例
const app = createApp(App);
//注册全局组件分页
app.component("Pagination", Pagination);
//确认框
app.config.globalProperties.$confirm = ElMessageBox;
// app.config.globalProperties.$ElMessage = ElMessage;
//字典
app.config.globalProperties.useDict = useDict;
app.config.globalProperties.addDateRange = addDateRange;
app.config.globalProperties.handleTree = handleTree;
app.config.globalProperties.parseTime = parseTime;
const pinia = createPinia(App);
// for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
//   app.component(key, component);
// }

// 使用 ElementPlus 插件
app.use(ElementPlus);
directive(app);
app.use(elementIcons);
app.component("svg-icon", SvgIcon);

app.use(pinia);
app.use(router);
// 挂载到 #app
app.mount("#app");
